package XML_test;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.util.List;

public class test {
    public static void main(String[] args) throws DocumentException {
        SAXReader saxReader = new SAXReader();
        Document document = saxReader.read("D:\\javaeework\\javaday11_work\\src\\books.xml");
        Element root = document.getRootElement();
        List<Element> list = root.elements();
        for (Element book : list) {
            String name = book.elementText("name");
            String pulisher = book.elementText("publisher");
            String Data = book.elementText("Data");
            String price = book.elementText("price");
            System.out.println("name = " + name + "publish=" + pulisher + "Data=" + Data + "price=" + price);

        }


    }
}

